float4x4 matWorldViewProj;
float4x4 matWorld;
float4 vLightDirection;

struct OUT
{
    float4 Pos: POSITION;
    float3 L: TEXCOORD0;
    float3 N: TEXCOORD1;
};
    
OUT VertexShader(float4 Pos: POSITION, float3 N: NORMAL)
{
    OUT Out = (OUT) 0;
    Out.Pos = mul(Pos, matWorldViewProj);
    Out.L = normalize(vLightDirection);
    Out.N = normalize(mul(N, matWorld));
    return Out;
}

float4 PixelShader(float3 L: TEXCOORD0, float3 N: TEXCOORD1) : COLOR
{
    float Ai = 0.8f;
    float4 Ac = float4(0.075, 0.075, 0.2, 1.0);
    float Di = 1.0f;
    float4 Dc = float4(1.0, 1.0, 1.0, 1.0);
    
    return Ai * Ac + Di * Dc * saturate(dot(L,N));
}

technique DiffuseLight
{
    pass P0
    {
        VertexShader = compile vs_1_1 VertexShader();
        PixelShader = compile ps_1_1 PixelShader();
    }
}